<template>
  <div class="test-stepin">
    <div class="test-header">
      <h1>智能左右滑动转场效果测试</h1>
      <p>体验智能转场：前进时新页面从右侧滑入，后退时从左侧滑入</p>
    </div>

    <div class="test-content">
      <div class="test-section">
        <h2>测试链接</h2>
        <p>点击任意位置，然后点击下面的链接，观察转场效果：</p>
        
        <div class="test-links">
          <router-link to="/product/123" class="test-link">
            商品详情页面
          </router-link>
          
          <router-link to="/user/profile" class="test-link">
            用户资料页面
          </router-link>
          
          <router-link to="/order/456" class="test-link">
            订单详情页面
          </router-link>
          
          <router-link to="/admin/users" class="test-link">
            用户管理页面
          </router-link>
        </div>
      </div>

      <div class="test-section">
        <h2>使用说明</h2>
        <ol>
          <li><strong>前进转场测试：</strong>点击上面的任意链接</li>
          <li><strong>观察效果：</strong>新页面从右侧滑入，原页面向左侧滑出</li>
          <li><strong>后退转场测试：</strong>按浏览器后退按钮（←）</li>
          <li><strong>观察效果：</strong>新页面从左侧滑入，原页面向右侧滑出</li>
          <li><strong>多次测试：</strong>体验智能的前进/后退转场效果</li>
        </ol>
        
        <div class="test-tip">
          <h3>💡 测试提示</h3>
          <p><strong>关键：</strong>使用浏览器的后退按钮（←）来测试反向转场效果，不要使用页面内的返回链接。</p>
        </div>
      </div>

      <div class="test-section">
        <h2>技术原理</h2>
        <ul>
          <li><strong>智能转场：</strong>自动检测前进/后退状态，应用不同的转场效果</li>
          <li><strong>前进转场：</strong>新页面从右侧滑入，原页面向左侧滑出</li>
          <li><strong>后退转场：</strong>新页面从左侧滑入，原页面向右侧滑出</li>
          <li><strong>路由检测：</strong>通过路由索引比较判断前进/后退状态</li>
          <li><strong>绝对定位：</strong>使用position: absolute确保页面层叠效果</li>
          <li><strong>层叠顺序：</strong>新页面在上层，原页面在下层</li>
          <li><strong>缓动函数：</strong>使用cubic-bezier实现自然的动画曲线</li>
          <li><strong>性能优化：</strong>使用CSS transform实现硬件加速</li>
        </ul>
      </div>

      <div class="test-section">
        <h2>返回首页</h2>
        <router-link to="/" class="home-link">
          返回首页
        </router-link>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
// 测试页面逻辑
</script>

<style scoped>
.test-stepin {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
}

.test-header {
  text-align: center;
  margin-bottom: 40px;
  padding: 30px;
  background: linear-gradient(135deg, #ff6b35 0%, #ff8c42 100%);
  color: white;
  border-radius: 15px;
  box-shadow: 0 4px 20px rgba(255, 107, 53, 0.3);
}

.test-header h1 {
  font-size: 2.5rem;
  margin-bottom: 10px;
  font-weight: 700;
}

.test-header p {
  font-size: 1.1rem;
  opacity: 0.9;
}

.test-content {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.test-section {
  background: white;
  padding: 25px;
  border-radius: 12px;
  box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
}

.test-section h2 {
  color: #ff6b35;
  margin-bottom: 15px;
  font-size: 1.5rem;
  border-bottom: 2px solid #ff6b35;
  padding-bottom: 10px;
}

.test-section p {
  color: #666;
  line-height: 1.6;
  margin-bottom: 15px;
}

.test-links {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-top: 20px;
}

.test-link {
  display: inline-block;
  padding: 15px 25px;
  background: #ff6b35;
  color: white;
  text-decoration: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 500;
  text-align: center;
  transition: all 0.3s ease;
  transform: scale(1);
}

.test-link:hover {
  background: #e55a2b;
  transform: scale(1.02);
  box-shadow: 0 4px 15px rgba(255, 107, 53, 0.3);
}

.test-link:active {
  transform: scale(0.98);
}

.test-section ol,
.test-section ul {
  color: #555;
  line-height: 1.8;
  padding-left: 20px;
}

.test-section li {
  margin-bottom: 8px;
}

.test-section strong {
  color: #333;
}

.test-tip {
  background-color: #f0f9eb;
  border: 1px solid #e1f3d8;
  border-radius: 8px;
  padding: 15px;
  margin-top: 20px;
}

.test-tip h3 {
  color: #67c23a;
  margin-top: 0;
  margin-bottom: 10px;
  font-size: 1.2rem;
}

.test-tip p {
  color: #909399;
  font-size: 0.9rem;
  line-height: 1.6;
}

.home-link {
  display: inline-block;
  padding: 12px 30px;
  background: #2c3e50;
  color: white;
  text-decoration: none;
  border-radius: 25px;
  font-size: 16px;
  font-weight: 500;
  transition: all 0.3s ease;
  transform: scale(1);
}

.home-link:hover {
  background: #34495e;
  transform: scale(1.05);
  box-shadow: 0 4px 15px rgba(44, 62, 80, 0.3);
}

.home-link:active {
  transform: scale(0.95);
}

/* 响应式设计 */
@media (max-width: 768px) {
  .test-stepin {
    padding: 15px;
  }
  
  .test-header {
    padding: 20px;
  }
  
  .test-header h1 {
    font-size: 2rem;
  }
  
  .test-links {
    gap: 10px;
  }
  
  .test-link {
    padding: 12px 20px;
    font-size: 14px;
  }
}
</style>
